<?$this->load->view('admin/tools/admin-header')?>
<?$this->load->view('admin/tools/admin-menu')?>

<div class="wrap">
	<a href=""><div id="icon-index" class="icon32"><br /></div></a><br>
<h3><a>Manage -> Listing</a></h3>
<?if($mode!=""){echo"<div id='message' class='updated fade'><p>$pesan</p></div>";}?>
<div id="dashboard-widgets-wrap">
<form id="posts-filter" onsubmit="return confirm('Pastikan Data yang akan dihapus dalam keadaan tercentang.')" action="<?=site_url('administrator/multi_delete_listing');?>" method="POST">
<table width="90%">
<tr>	
	<td width="30px">
	<input type="submit" value="Delete" name="delete"/>
	</td>
	<td>
	<input type="button" value="Tambah Listing" onclick="document.location='<?=site_url("administrator/input_listing_step1")?>'"/>
	</td>
		<?/*<td style="float:right">
		<form action="<?=site_url('administrator/mng_kisah_inspiratif/');?>" method="POST">
		<table>
			<tr>
				<td>
				<select name="cari_kategori">
					<option value="judul">Judul</option>
					<option value="tanggal">Tanggal</option>
					<option value="penulis">penulis</option>
					<option value="status">Status</option>
				</select>
				</td>
				<td id="searchNoDate">
					<input type="text" name="cari_deskripsi" size="40"/>
				</td>
				<td id="searchDate" style="display:none">
					<select name="hari">
						<option value="">-Hari-</option>
						<?for($i=1;$i<32;$i++){?>
						<option value="<?=$i?>"><?=$i?></option>
						<?}?>
					</select>-<select name="bulan">
						<option value="">-Bulan-</option>
						<?for($i=1;$i<13;$i++){?>
						<option value="<?=$i?>"><?=$i?></option>
						<?}?>
					</select>-<select name="tahun">
						<option value="">-tahun-</option>
						<?for($i=date("Y")-15;$i<date("Y")+6;$i++){?>
						<option value="<?=$i?>"><?=$i?></option>
						<?}?>
					</select>
				</td>
				<td>
					<input type="submit" value="Cari"/>
				</td>
			</tr>
		</table>
		</form>
	</td>*/?>
</tr>
</table>

<br class="clear" />
<form id="posts-filter" onsubmit="return confirm('Pastikan Data yang akan dihapus dalam keadaan tercentang.')" action="<?=site_url('administrator/multi_listing');?>" method="POST">

<table width="90%">
	<thead>
	<tr style="background:#9b9b9b;color:yellow;font-family:arial;height:25px;">
		<th scope="col" class="th-view check-column"><input type="checkbox" /></th>
		<th scope="col" class="th-view" >No</th>
		<th scope="col" class="th-view" width="10%">Kode Listing</th>
		<th scope="col" class="th-view" width="12%">Property</th>
		<th scope="col" class="th-view" width="8%">Tipe</th>
		<th scope="col" class="th-view" width="25%">Harga</th>
		<th scope="col" class="th-view" width="20%">Lokasi</th>
		<th scope="col" class="th-view" width="10%">Nip</th>
		<th scope="col" class="th-view" width="15%">Aksi</th>
	</tr>
	</thead>
	<tbody>
	<?
	$i=1;
	$uri = $this->uri->segment(3);
	if($uri==null){$uri=0;}
	foreach ($query as $row)
		{
			$kode_listing	= $row->kode_listing;
			$tipe_property	= $row->tipe_property;
			$tipe_listing	= $row->tipe_listing;
			$deskripsi	    = $row->deskripsi;
			$nip_marketing	= $row->nip_marketing;
			$lokasi			= $row->lokasi;
			$harga			= $row->harga;
			$status			= $row->status_listing;
			
			 $angka = $harga;
			 $rupiah="";
			 $rp=strlen($angka);
			 while ($rp>3){
			 $rupiah = ".". substr($angka,-3). $rupiah;
			 $s=strlen($angka) - 3;
			 $angka=substr($angka,0,$s);
			 $rp=strlen($angka);
			 }
			$rupiah = "Rp. " . $angka . $rupiah . ",00-";
			
			$tipe_property = ucwords(str_replace("_"," ",$tipe_property));
			$tipe_listing = ucfirst($tipe_listing);
			
			if($status=='tersedia'){
				$gambar="yes.png";
				$title ="Tersedia";
			}else{
				$gambar="cross.png";	
				$title ="Sudah Laku";
			}
			
			$dataMarketing = $this->tbl_marketing->edit_marketing($nip_marketing);	
			foreach ($dataMarketing as $rowM){
			$nip		= $rowM->nip;
			$nama		= $rowM->nama;
			$email	 	= $rowM->email;
			$foto2		= $rowM->foto;
			}
        
		?>
	<tr style="background:#FFFFFF"valign="center">

		<th scope="row" class="td-view check-column"><input type="checkbox" name="cekbok[]" value="<?=$kode_listing;?>" /></th>
		<td class="td-view"><?=($i+$uri);?></td>	
		<td class="td-view" width="10%"><?=$kode_listing?><img style="position:fix top;float:right;" align="left" src="<?=base_url()?>css/icon/<?=$gambar?>" title="<?=$title?>"></td>
		<td class="td-view" width="12%"><?=$tipe_property?></td>	
		<td class="td-view" width="8%"><?=$tipe_listing?></td>
		<td class="td-view" width="25%" align="right"><?=$rupiah?></td>
		<td class="td-view" width="20%"><?=$lokasi?></td>		
		<td class="td-view" width="10%" align="justify"><a class="tooltip" href="#"><?=$nama?><span class="custom info"><img src="<?=base_url()?>css/info.png" alt="Information" height="48" width="48" /><em><?=$nip;?></em></span></a></td>	
		<td class="td-view" width="15%" align="center">
		<a href="<?=site_url('administrator/view_listing_foto/'.$kode_listing)?>" title="View Gambar Listing"><img src="<?=base_url()?>css/icon/folder.png"></a>&nbsp;|&nbsp;<a href="<?//=site_url('administrator/view_kisah_inspiratif/'.$id)?>" title="View Detail"><img src="<?=base_url()?>css/icon/view.png"></a>&nbsp;|&nbsp;<a href="<?=site_url('administrator/edit_listing/'.$kode_listing)?>" title="Edit Artikel"><img src="<?=base_url()?>css/icon/edit.png"></a>&nbsp;|&nbsp;<a href="<?=site_url('administrator/delete_listing/'.$kode_listing)?>" title="Delete Artikel"><img src="<?=base_url()?>css/icon/delete.png"></a></td>
	</tr>
	<?$i++;}?>
	</tbody>
</table>
</form>
<table width="250" align="center" border="1">
		<tr style="background:">
			<td width="250" valign="middle" align="center">
			<font face=verdana size=2 color=#FF0000>
			<div style="float:left">
				<center>Banyak Data : <b><?=$jumlah?></b></center>
				<center><a><?echo $this->pagination->create_links();?></a></center>
			</div></font>
			</td>
		</tr>
	</table>
</div>
</div><!-- wrap -->

<div class="clear"></div></div><!-- wpbody-content -->
<div class="clear"></div></div><!-- wpbody -->
<div class="clear"></div></div><!-- wpcontent -->
</div><!-- wpwrap -->

<!--admin-footer-->
<?$this->load->view('admin/tools/admin-footer');?>
<!--admin-footer-->
